<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AUnit: aunit::internal::FCString Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AUnit
   &#160;<span id="projectnumber">1.7.1</span>
   </div>
   <div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>aunit</b></li><li class="navelem"><b>internal</b></li><li class="navelem"><a class="el" href="classaunit_1_1internal_1_1FCString.html">FCString</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="classaunit_1_1internal_1_1FCString-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">aunit::internal::FCString Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A union of (const char*) and (const __FlashStringHelper*) with a discriminator.  
 <a href="classaunit_1_1internal_1_1FCString.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="FCString_8h_source.html">FCString.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a0457d023c5ff82acac292bd3962189d2"><td class="memItemLeft" align="right" valign="top"><a id="a0457d023c5ff82acac292bd3962189d2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a0457d023c5ff82acac292bd3962189d2">FCString</a> ()</td></tr>
<tr class="memdesc:a0457d023c5ff82acac292bd3962189d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor initializes to a nullptr of kCStringType. <br /></td></tr>
<tr class="separator:a0457d023c5ff82acac292bd3962189d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8f72e4b0a05e4d8d02dc4ed01ec52be"><td class="memItemLeft" align="right" valign="top"><a id="ad8f72e4b0a05e4d8d02dc4ed01ec52be"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#ad8f72e4b0a05e4d8d02dc4ed01ec52be">FCString</a> (const char *s)</td></tr>
<tr class="memdesc:ad8f72e4b0a05e4d8d02dc4ed01ec52be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct with a c-string. <br /></td></tr>
<tr class="separator:ad8f72e4b0a05e4d8d02dc4ed01ec52be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a132e8e97f81750c71faee4e49866e269"><td class="memItemLeft" align="right" valign="top"><a id="a132e8e97f81750c71faee4e49866e269"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a132e8e97f81750c71faee4e49866e269">FCString</a> (const __FlashStringHelper *s)</td></tr>
<tr class="memdesc:a132e8e97f81750c71faee4e49866e269"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct with a flash string. <br /></td></tr>
<tr class="separator:a132e8e97f81750c71faee4e49866e269"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a18d41c990f2843ac1f922d4ca5c65399"><td class="memItemLeft" align="right" valign="top"><a id="a18d41c990f2843ac1f922d4ca5c65399"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a18d41c990f2843ac1f922d4ca5c65399">getType</a> () const</td></tr>
<tr class="memdesc:a18d41c990f2843ac1f922d4ca5c65399"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the internal type of string. <br /></td></tr>
<tr class="separator:a18d41c990f2843ac1f922d4ca5c65399"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03e7eb782104ca65cb2dfe161540833e"><td class="memItemLeft" align="right" valign="top"><a id="a03e7eb782104ca65cb2dfe161540833e"></a>
const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a03e7eb782104ca65cb2dfe161540833e">getCString</a> () const</td></tr>
<tr class="memdesc:a03e7eb782104ca65cb2dfe161540833e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the c-string pointer. <br /></td></tr>
<tr class="separator:a03e7eb782104ca65cb2dfe161540833e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4139be1f5381faebcb54b3d357957cb4"><td class="memItemLeft" align="right" valign="top"><a id="a4139be1f5381faebcb54b3d357957cb4"></a>
const __FlashStringHelper *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a4139be1f5381faebcb54b3d357957cb4">getFString</a> () const</td></tr>
<tr class="memdesc:a4139be1f5381faebcb54b3d357957cb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the flash string pointer. <br /></td></tr>
<tr class="separator:a4139be1f5381faebcb54b3d357957cb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4a029df196558927f210314c2e28944"><td class="memItemLeft" align="right" valign="top"><a id="ac4a029df196558927f210314c2e28944"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#ac4a029df196558927f210314c2e28944">print</a> (Print *printer) const</td></tr>
<tr class="memdesc:ac4a029df196558927f210314c2e28944"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convenience method for printing an <a class="el" href="classaunit_1_1internal_1_1FCString.html" title="A union of (const char*) and (const __FlashStringHelper*) with a discriminator.">FCString</a>. <br /></td></tr>
<tr class="separator:ac4a029df196558927f210314c2e28944"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae2e214a9db25ed35ae6f448cf133ed1e"><td class="memItemLeft" align="right" valign="top"><a id="ae2e214a9db25ed35ae6f448cf133ed1e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#ae2e214a9db25ed35ae6f448cf133ed1e">println</a> (Print *printer) const</td></tr>
<tr class="memdesc:ae2e214a9db25ed35ae6f448cf133ed1e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convenience method for printing an <a class="el" href="classaunit_1_1internal_1_1FCString.html" title="A union of (const char*) and (const __FlashStringHelper*) with a discriminator.">FCString</a>. <br /></td></tr>
<tr class="separator:ae2e214a9db25ed35ae6f448cf133ed1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf5327720f6e7c88aa8696dd90d5f1c5"><td class="memItemLeft" align="right" valign="top"><a id="abf5327720f6e7c88aa8696dd90d5f1c5"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#abf5327720f6e7c88aa8696dd90d5f1c5">compareTo</a> (const <a class="el" href="classaunit_1_1internal_1_1FCString.html">FCString</a> &amp;that) const</td></tr>
<tr class="memdesc:abf5327720f6e7c88aa8696dd90d5f1c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compare to another <a class="el" href="classaunit_1_1internal_1_1FCString.html" title="A union of (const char*) and (const __FlashStringHelper*) with a discriminator.">FCString</a>. <br /></td></tr>
<tr class="separator:abf5327720f6e7c88aa8696dd90d5f1c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c99cb7f0ffc35e40f3b53c711a44a08"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a7c99cb7f0ffc35e40f3b53c711a44a08">compareToN</a> (const char *that, size_t n) const</td></tr>
<tr class="memdesc:a7c99cb7f0ffc35e40f3b53c711a44a08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compare to C-string using the first n characters.  <a href="classaunit_1_1internal_1_1FCString.html#a7c99cb7f0ffc35e40f3b53c711a44a08">More...</a><br /></td></tr>
<tr class="separator:a7c99cb7f0ffc35e40f3b53c711a44a08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88450f2b8adcd7b37c356d318abae777"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a88450f2b8adcd7b37c356d318abae777">compareToN</a> (const __FlashStringHelper *that, size_t n) const</td></tr>
<tr class="memdesc:a88450f2b8adcd7b37c356d318abae777"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compare to a flash string using the first n characters.  <a href="classaunit_1_1internal_1_1FCString.html#a88450f2b8adcd7b37c356d318abae777">More...</a><br /></td></tr>
<tr class="separator:a88450f2b8adcd7b37c356d318abae777"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1edb001f5735b990779dbac22a2e4d52"><td class="memItemLeft" align="right" valign="top"><a id="a1edb001f5735b990779dbac22a2e4d52"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classaunit_1_1internal_1_1FCString.html#a1edb001f5735b990779dbac22a2e4d52">hasSubstring</a> (const char *substring) const</td></tr>
<tr class="memdesc:a1edb001f5735b990779dbac22a2e4d52"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine if given substring exists. <br /></td></tr>
<tr class="separator:a1edb001f5735b990779dbac22a2e4d52"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:aa3674b4bfeb7be51cbb4eec7a34c3cde"><td class="memItemLeft" align="right" valign="top"><a id="aa3674b4bfeb7be51cbb4eec7a34c3cde"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>kCStringType</b> = 0</td></tr>
<tr class="separator:aa3674b4bfeb7be51cbb4eec7a34c3cde"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa9fe02695f38ad367e04b7a9de65d7b8"><td class="memItemLeft" align="right" valign="top"><a id="aa9fe02695f38ad367e04b7a9de65d7b8"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>kFStringType</b> = 1</td></tr>
<tr class="separator:aa9fe02695f38ad367e04b7a9de65d7b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A union of (const char*) and (const __FlashStringHelper*) with a discriminator. </p>
<p>This allows us to treat these 2 strings like a single object. The major reason this class is needed is because the F() cannot be used outside a function, it can only be used inside a function, so we are forced to use normal c-strings instead of F() strings when manually creating <a class="el" href="classaunit_1_1Test.html" title="Base class of all test cases.">Test</a> or <a class="el" href="classaunit_1_1TestOnce.html" title="Similar to TestAgain but performs user-defined test only once.">TestOnce</a> instances.</p>
<p>I deliberately decided not to inherit from Printable. While it is convenient to be able to call Print::print() with an instance of this class, the cost is 2 bytes (8-bit processors) or 4 bytes (32-bit processors) of extra static memory for the v-table pointer for each instance. But each instance is only 3 bytes (8-bits) or 5 bytes (32-bits) big, so the cost of 50-100 bytes of static memory for a large suite of 25 unit tests does not seem worth the minor convenience.</p>
<p>Use the <a class="el" href="classaunit_1_1internal_1_1FCString.html#ac4a029df196558927f210314c2e28944" title="Convenience method for printing an FCString.">print()</a> and <a class="el" href="classaunit_1_1internal_1_1FCString.html#ae2e214a9db25ed35ae6f448cf133ed1e" title="Convenience method for printing an FCString.">println()</a> methods to print to the given 'Print'. In hindsight, with more Arduino programming under my belt, I think these functions should accept a reference <code>Print&amp;</code> instead of a pointer <code>Print*</code>. That is how I implemented this in a subsequent version of this class in the AceCommon library. </p>

<p class="definition">Definition at line <a class="el" href="FCString_8h_source.html#l00058">58</a> of file <a class="el" href="FCString_8h_source.html">FCString.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a88450f2b8adcd7b37c356d318abae777"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88450f2b8adcd7b37c356d318abae777">&#9670;&nbsp;</a></span>compareToN() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int aunit::internal::FCString::compareToN </td>
          <td>(</td>
          <td class="paramtype">const __FlashStringHelper *&#160;</td>
          <td class="paramname"><em>that</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compare to a flash string using the first n characters. </p>
<p>This is expected to be used only for <a class="el" href="classaunit_1_1TestRunner.html#ad55fbb77f52eb2c1a2d45536e8c4afba" title="Exclude the tests which match the pattern.">TestRunner::exclude()</a> and <a class="el" href="classaunit_1_1TestRunner.html#a63301f8ab1cbbf1b7cca7a35434b00d2" title="Include the tests which match the pattern.">TestRunner::include()</a>. </p>

<p class="definition">Definition at line <a class="el" href="FCString_8cpp_source.html#l00079">79</a> of file <a class="el" href="FCString_8cpp_source.html">FCString.cpp</a>.</p>

</div>
</div>
<a id="a7c99cb7f0ffc35e40f3b53c711a44a08"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c99cb7f0ffc35e40f3b53c711a44a08">&#9670;&nbsp;</a></span>compareToN() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int aunit::internal::FCString::compareToN </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>that</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compare to C-string using the first n characters. </p>
<p>This is expected to be used only for <a class="el" href="classaunit_1_1TestRunner.html#ad55fbb77f52eb2c1a2d45536e8c4afba" title="Exclude the tests which match the pattern.">TestRunner::exclude()</a> and <a class="el" href="classaunit_1_1TestRunner.html#a63301f8ab1cbbf1b7cca7a35434b00d2" title="Include the tests which match the pattern.">TestRunner::include()</a>. </p>

<p class="definition">Definition at line <a class="el" href="FCString_8cpp_source.html#l00071">71</a> of file <a class="el" href="FCString_8cpp_source.html">FCString.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/brian/src/AUnit/src/aunit/<a class="el" href="FCString_8h_source.html">FCString.h</a></li>
<li>/home/brian/src/AUnit/src/aunit/<a class="el" href="FCString_8cpp_source.html">FCString.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
